package com.ltd.testviewgroup;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import com.ltd.testviewgroup.viewgroup.WorkSpace;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class MainActivity extends AppCompatActivity {

    @Bind(R.id.leftButton)
    Button mLeftButton;
    @Bind(R.id.rightButton)
    Button mRightButon;


    WorkSpace workSpace ;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        workSpace = (WorkSpace) super.findViewById(R.id.workspace);
        ButterKnife.bind(this);
    }

    @OnClick({R.id.leftButton,R.id.rightButton})
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.leftButton:
                //让mTextView的内容往左移
                workSpace.scrollBy(30, 0);
                //让mLeftButton的内容也往左移
//                mLeftButton.scrollBy(20, 0);
                break;
            case R.id.rightButton:
                //让mTextView的内容往右移直接到-30的位置
                workSpace.scrollTo(-30, 0);
                break;
            default:
                break;
        }
    }
}
